package cn.edu.scau.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.scau.dao.DishMapper;
import cn.edu.scau.entity.Dish;
import cn.edu.scau.service.DishService;

@Service
public class DishServiceImpl implements DishService {
	@Autowired
	private DishMapper dishMapper;

	
	@Override
	public boolean insert(Dish dish) {
		//业务逻辑判断
		int line = dishMapper.insertSelective(dish);
		return line == 1 ? true:false;
	}

	@Override
	public boolean update(Dish dish) {
		//业务逻辑判断
		int line = dishMapper.updateByPrimaryKeySelective(dish);
		return line == 1 ? true:false;
	}

	@Override
	public boolean delete(Integer id) {
		//业务逻辑判断
		int line = dishMapper.deleteByPrimaryKey(id);
		return line == 1 ? true:false;
	}

	@Override
	public Dish selectById(Integer id) {
		//业务逻辑判断
		return dishMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Dish> selectAll() {
		//业务逻辑判断
		return dishMapper.selectAll();
	}

	@Override
	public List<Dish> findByNameTypeFeatures(String dishname, String dishtype, String dishfeatures) {
		//业务逻辑判断
		return dishMapper.findByNameTypeFeatures(dishname, dishtype, dishfeatures);
	}

}
